export const DEFAULT_SETTINGS = {
  model: 'deepseek-chat',
  temperature: 0.3,
  enableCoT: false,
  cotMode: 'ZERO_SHOT',
  cotExample: '',
  chatMode: 'BASIC',
  showToolResults: true,
  imageUrls: [],
  prompt: '你是一个乐于助人的 AI 智能助手',
};

export function loadSessionSettings(sessionId) {
  if (!sessionId) return { ...DEFAULT_SETTINGS };
  try {
    const raw = localStorage.getItem(`chat_settings_${sessionId}`);
    if (!raw) return { ...DEFAULT_SETTINGS };
    const parsed = JSON.parse(raw);
    return { ...DEFAULT_SETTINGS, ...parsed };
  } catch {
    return { ...DEFAULT_SETTINGS };
  }
}

export function saveSessionSettings(sessionId, settings) {
  if (!sessionId) return;
  localStorage.setItem(`chat_settings_${sessionId}`, JSON.stringify(settings));
}
